String.prototype.template2string = function (params) {
  const keys = Object.keys(params)
  const values = Object.values(params)
  return new Function(...keys, `return \`${this}\``)(...values)
}

String.prototype.temp2str = String.prototype.template2string

window.lf = localforage

window.cache = {}

window.$ = function(selector) {
  return document.querySelector(selector)
}

window.$$ = function(selector) {
  return Array.from(document.querySelectorAll(selector))
}

window.loading = function() {
  document.body.style.opacity = .2
}

window.unloading = function() {
  document.body.style.opacity = 1
}